﻿/*
* 微信分享
*/
function shareWeChat(imgUrl, url, title, cotent) {
    window.shareData = {
        "imgUrl": imgUrl,
        "timeLineLink": url,
        "tTitle": title,
        "tContent": cotent
    };

    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.on('menu:share:appmessage', function (argv) {
            WeixinJSBridge.invoke('sendAppMessage', {
                "img_url": window.shareData.imgUrl,
                "link": window.shareData.timeLineLink,
                "desc": window.shareData.tContent,
                "title": window.shareData.tTitle
            }, function (res) {
                document.location.href = mebtnopenurl;
            })
        });

        WeixinJSBridge.on('menu:share:timeline', function (argv) {
            WeixinJSBridge.invoke('shareTimeline', {
                "img_url": window.shareData.imgUrl,
                "link": window.shareData.timeLineLink,
                "desc": window.shareData.tContent,
                "title": window.shareData.tTitle
            }, function (res) {
                document.location.href = mebtnopenurl;
            });
        });
    }, false);
}

/*
* 设置menu
*/
function getMenu() {
    var currUrl = window.location.href;
    var isDef = true;
    //特殊检车报告
    if (currUrl.indexOf("record.aspx?t=r") >= 0) {
        $("#menu .current").removeClass("current");
        $("#menu a:eq(2)").addClass("current");
        return;
    }
    $("#menu a").each(function () {
        var url = $(this).attr("href");
        url = url.substring(url.lastIndexOf("/"));

        if (currUrl.indexOf(url) >= 0) {
            $("#menu .current").removeClass("current");
            $(this).addClass("current");
            isDef = false;
            return;
        }
    });
    if (isDef)
        $("#menu a:eq(0)").addClass("current");
}
/*
* 退出登录
*/
function loginOut() {
    ZWEB.AJAX.Call("login_out", load_callback, {}, { ws_path: "/web/mobile/login/index.aspx" });
    function load_callback(r_code, r_msg, r_obj) {
        this.location.href = location.href;
    }
}
/*
* 页面跳转
*/
function redirct(url) {
    location.href = url;
}

/*
* 返回顶部
*/
function backTop() {
    $("body").animate({ scrollTop: 0 }, 600);
}